//
//  DebatestormdetailsTableViewCell.m
//  Gxj
//
//  Created by 💋索少杰 on 2017/10/19.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "DebatestormdetailsTableViewCell.h"

@implementation DebatestormdetailsTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.zhutiDebate];
        [self.contentView addSubview:self.carriedOut];
        [self.contentView addSubview:self.theLabel];
        [self.contentView addSubview:self.timeImage];
        [self.contentView addSubview:self.timeLabel];
        [self.contentView addSubview:self.iconLiulang];
        [self.contentView addSubview:self.liulangNum];
        [self.contentView addSubview:self.retangleView];
        [self.retangleView addSubview:self.retangleOne];
        [self.retangleView addSubview:self.retangleTwo];
        [self.retangleView addSubview:self.tetragonal];
        [self.retangleView addSubview:self.antiside];
        [self.retangleView addSubview:self.imagePk];
        [self.retangleView addSubview:self.literalsPKOne];
        [self.retangleView addSubview:self.literalsPKTwo];
        [self.contentView addSubview:self.butOne];
        [self.contentView addSubview:self.butTwo];
        [self.contentView addSubview:self.customProgressView];
        [self.contentView addSubview:self.zhengLabel];
        [self.contentView addSubview:self.fanLabel];
        [self.retangleView addSubview:self.zhengBut];
        [self.retangleView addSubview:self.fanBut];
        
        //适配方法
        [self setUpshipei];
    }
    return self;
}

- (void)setUpshipei{
    
    _zhutiDebate.sd_layout
    .topSpaceToView(self.contentView, kHeightScale(10))
    .leftSpaceToView(self.contentView, kWidthScale(15))
    .rightSpaceToView(self.contentView, kWidthScale(45))
    .autoHeightRatio(0);
    
    _carriedOut.sd_layout
    .topSpaceToView(self.contentView, kHeightScale(10))
    .rightSpaceToView(self.contentView, kWidthScale(15))
    .widthIs(kWidthScale(36))
    .heightIs(kHeightScale(16));
    
    _theLabel.sd_layout
    .topSpaceToView(self.zhutiDebate, kHeightScale(8))
    .leftSpaceToView(self.contentView, kWidthScale(15))
    .widthIs(kWidthScale(35))
    .heightIs(kHeightScale(16));
    
    _timeImage.sd_layout
    .topSpaceToView(self.zhutiDebate, kHeightScale(9))
    .leftSpaceToView(self.theLabel, kWidthScale(10))
    .widthIs(kWidthScale(13))
    .heightIs(kHeightScale(13));
    
    _timeLabel.sd_layout
    .topSpaceToView(self.zhutiDebate, kHeightScale(8))
    .leftSpaceToView(self.timeImage, kWidthScale(5))
    .widthIs(kWidthScale(30))
    .autoHeightRatio(0);
    
    _iconLiulang.sd_layout
    .topSpaceToView(self.zhutiDebate, kHeightScale(11))
    .leftSpaceToView(self.timeLabel, kWidthScale(5))
    .widthIs(kWidthScale(13))
    .heightIs(kHeightScale(8.6));
    
    _liulangNum.sd_layout
    .topEqualToView(self.timeLabel)
    .leftSpaceToView(self.iconLiulang, kWidthScale(5))
    .widthIs(kWidthScale(40))
    .autoHeightRatio(0);
    
    _retangleView.sd_layout
    .topSpaceToView(self.theLabel, kHeightScale(8))
    .leftSpaceToView(self.contentView, 0)
    .rightSpaceToView(self.contentView, 0)
    .heightIs(kHeightScale(95));
    
    _tetragonal.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(5))
    .leftSpaceToView(self.retangleView, kWidthScale(70.5))
    .widthIs(kWidthScale(50))
    .autoHeightRatio(0);
    
    _antiside.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(5))
    .rightSpaceToView(self.retangleView, kWidthScale(70.5))
    .widthIs(kWidthScale(50))
    .autoHeightRatio(0);
    //pk图片
    _imagePk.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(46))
    .leftSpaceToView(self.retangleOne, kWidthScale(-2))
    .widthIs(kWidthScale(27))
    .heightIs(kHeightScale(16));
    
    //pk文字
    _literalsPKOne.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(24))
    .leftSpaceToView(self.retangleView, kWidthScale(12))
    .widthIs(kWidthScale(170))
    .heightIs(kHeightScale(60));
    
    _literalsPKTwo.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(24))
    .rightSpaceToView(self.retangleView, kWidthScale(9))
    .widthIs(kWidthScale(170))
    .heightIs(kHeightScale(60));
    //正方支持
    _butOne.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(15))
    .leftSpaceToView(self.contentView, kWidthScale(15))
    .widthIs(kWidthScale(78/2))
    .heightIs(kHeightScale(78/2));
    //反方支持
    _butTwo.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(15))
    .rightSpaceToView(self.contentView, kWidthScale(15))
    .widthIs(kWidthScale(78/2))
    .heightIs(kHeightScale(78/2));
    //进度条
    _customProgressView.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(49/2))
    .leftSpaceToView(self.butOne, kWidthScale(10))
    .rightSpaceToView(self.butTwo, kWidthScale(10))
    .heightIs(kHeightScale(20));
    //正人数
    _zhengLabel.sd_layout
    .topSpaceToView(self.customProgressView, kHeightScale(3))
    .leftSpaceToView(self.contentView, kWidthScale(125))
    .widthIs(kWidthScale(50))
    .autoHeightRatio(0);
    //反人数
    _fanLabel.sd_layout
    .topSpaceToView(self.customProgressView, kHeightScale(3))
    .rightSpaceToView(self.contentView, kWidthScale(80))
    .widthIs(kWidthScale(50))
    .autoHeightRatio(0);
    //押注按钮
    _zhengBut.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(24))
    .leftSpaceToView(self.retangleView, kWidthScale(12))
    .widthIs(kWidthScale(170))
    .heightIs(kHeightScale(60));
    
    _fanBut.sd_layout
    .topSpaceToView(self.retangleView, kHeightScale(24))
    .rightSpaceToView(self.retangleView, kWidthScale(9))
    .widthIs(kWidthScale(170))
    .heightIs(kHeightScale(60));
}
//主题
- (UILabel *)zhutiDebate
{
    if (!_zhutiDebate)
    {
        _zhutiDebate=[[UILabel alloc] init];
        _zhutiDebate.text=@"大学生创业应立足于自身优秀还是市场需求？";
        _zhutiDebate.textColor = [UIColor colorWithHexString:@"#333333"];
        _zhutiDebate.font=[UIFont systemFontOfSize:kWidthScale(14)];
    }
    return _zhutiDebate;
}
//是否进行中
- (UILabel *)carriedOut
{
    if (!_carriedOut)
    {
        _carriedOut=[[UILabel alloc] init];
        _carriedOut.text=@"进行中";
        _carriedOut.textColor=[UIColor colorWithRed:(59.0/255) green:(0.0/255) blue:(204.0/255) alpha:1];
        _carriedOut.textAlignment = NSTextAlignmentCenter;
        _carriedOut.font=[UIFont systemFontOfSize:kWidthScale(10)];
        _carriedOut.layer.borderWidth=1;
        _carriedOut.layer.borderColor=[[UIColor colorWithRed:(118.0/255) green:(92.0/255) blue:(211.0/255) alpha:1]CGColor];
        _carriedOut.layer.masksToBounds=YES;
        _carriedOut.layer.cornerRadius=kWidthScale(5);
    }
    return _carriedOut;
}
//标签
- (UILabel *)theLabel
{
    if (!_theLabel)
    {
        _theLabel=[[UILabel alloc] init];
        _theLabel.text=@"商业";
        _theLabel.textColor=[UIColor colorWithRed:(14.0/255) green:(144.0/255) blue:(243.0/255) alpha:1];
        _theLabel.textAlignment = NSTextAlignmentCenter;
        _theLabel.font=[UIFont systemFontOfSize:kWidthScale(10)];
        _theLabel.layer.borderWidth=1;
        _theLabel.layer.borderColor=[[UIColor colorWithRed:(164.0/255) green:(194.0/255) blue:(252.0/255) alpha:1]CGColor];
        _theLabel.layer.masksToBounds=YES;
        _theLabel.layer.cornerRadius=kWidthScale(5);
    }
    return _theLabel;
}
//发表时间图标
- (UIImageView *)timeImage
{
    if (!_timeImage)
    {
        _timeImage=[[UIImageView alloc] init];
        _timeImage.image=[UIImage imageNamed:@"time"];
    }
    return _timeImage;
}
//时间
- (UILabel *)timeLabel
{
    if (!_timeLabel)
    {
        _timeLabel=[[UILabel alloc] init];
        _timeLabel.text=@"5:20";
        _timeLabel.textColor=[UIColor colorWithRed:(153.0/255) green:(153.0/255) blue:(153.0/255) alpha:1];
        _timeLabel.font=[UIFont systemFontOfSize:kWidthScale(12)];
    }
    return _timeLabel;
}
//浏览图标
- (UIImageView *)iconLiulang
{
    if (!_iconLiulang)
    {
        _iconLiulang=[[UIImageView alloc] init];
        _iconLiulang.image=[UIImage imageNamed:@"liulans"];
    }
    return _iconLiulang;
}
//浏览人数
- (UILabel *)liulangNum
{
    if (!_liulangNum)
    {
        _liulangNum=[[UILabel alloc] init];
        _liulangNum.text=@"100";
        _liulangNum.textColor=[UIColor colorWithRed:(153.0/255) green:(153.0/255) blue:(153.0/255) alpha:1];
        _liulangNum.font=[UIFont systemFontOfSize:kWidthScale(12)];
    }
    return _liulangNum;
}
//背景
- (UIView *)retangleView
{
    if (!_retangleView)
    {
        _retangleView=[[UIView alloc] init];
        _retangleView.backgroundColor=[UIColor colorWithRed:(245.0/255) green:(245.0/255) blue:(245.0/255) alpha:1];
        _retangleView.userInteractionEnabled = YES;
    }
    return _retangleView;
}
/** 矩形进度条*/
- (RectangleProgressView *)retangleOne
{
    if (!_retangleOne)
    {
        _retangleOne = [[RectangleProgressView alloc] initWithFrame:CGRectMake(kWidthScale(15), kHeightScale(8.5), kWidthScale(161), kHeightScale(85)) progress:0.50 standpoint:1 isFinished:NO isWinOrLose:1];
        _retangleOne.backgroundColor=[UIColor colorWithRed:(242.0/255) green:(242.0/255) blue:(242.0/255) alpha:1];
        _retangleOne.userInteractionEnabled=YES;
    }
    return _retangleOne;
}
- (RectangleProgressView *)retangleTwo
{
    if (!_retangleTwo)
    {
        _retangleTwo = [[RectangleProgressView alloc] initWithFrame:CGRectMake(kWidthScale(199), kHeightScale(8.5), kWidthScale(161), kHeightScale(85)) progress:0.50 standpoint:2 isFinished:NO isWinOrLose:1];
        _retangleTwo.backgroundColor=[UIColor colorWithRed:(242.0/255) green:(242.0/255) blue:(242.0/255) alpha:1];
        _retangleTwo.userInteractionEnabled=YES;
    }
    return _retangleTwo;
}
//正方
- (UILabel *)tetragonal
{
    if (!_tetragonal)
    {
        _tetragonal=[[UILabel alloc] init];
        _tetragonal.text=@"正方40/50";
        _tetragonal.textColor=[UIColor colorWithRed:(127.0/255) green:(0.0/255) blue:(247.0/255) alpha:1];
        _tetragonal.font=[UIFont systemFontOfSize:kWidthScale(10)];
    }
    return _tetragonal;
}
//反方
- (UILabel *)antiside
{
    if (!_antiside)
    {
        _antiside=[[UILabel alloc] init];
        _antiside.text=@"反方40/50";
        _antiside.textColor=[UIColor colorWithRed:(0.0/255) green:(88.0/255) blue:(252.0/255) alpha:1];
        _antiside.font=[UIFont systemFontOfSize:kWidthScale(10)];
    }
    return _antiside;
}

//pk图片
- (UIImageView *)imagePk
{
    if (!_imagePk)
    {
        _imagePk=[[UIImageView alloc] init];
        _imagePk.image=[UIImage imageNamed:@"pk-12"];
        _imagePk.backgroundColor=[UIColor colorWithRed:(242.0/255) green:(242.0/255) blue:(242.0/255) alpha:1];
    }
    return _imagePk;
}
//pk文字
- (KQlable *)literalsPKOne
{
    if (!_literalsPKOne)
    {
        _literalsPKOne=[[KQlable alloc] init];
        _literalsPKOne.userInteractionEnabled=YES;
        _literalsPKOne.text=@"啊啊啊啊。啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊撒旦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊。\n";
        _literalsPKOne.font=[UIFont systemFontOfSize:kWidthScale(11)];
        //_literalsPKOne.backgroundColor=[UIColor orangeColor];
        _literalsPKOne.numberOfLines=0;
        _literalsPKOne.textAlignment= NSTextAlignmentCenter;
        _literalsPKOne.textColor=[UIColor colorWithRed:(102.0/255) green:(102.0/255) blue:(102.0/255) alpha:1];
        [KQlable changeLineSpaceForLabel:_literalsPKOne WithSpace:5.0f];
    }
    return _literalsPKOne;
}
- (KQlable *)literalsPKTwo
{
    if (!_literalsPKTwo)
    {
        _literalsPKTwo=[[KQlable alloc] init];
        _literalsPKTwo.userInteractionEnabled=YES;
        _literalsPKTwo.text=@"啊啊啊啊。啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊撒旦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊。\n";
        _literalsPKTwo.font=[UIFont systemFontOfSize:kWidthScale(11)];
        //_literalsPKTwo.backgroundColor=[UIColor orangeColor];
        _literalsPKTwo.numberOfLines=0;
        _literalsPKTwo.textAlignment=NSTextAlignmentCenter;
        _literalsPKTwo.textColor=[UIColor colorWithRed:(102.0/255) green:(102.0/255) blue:(102.0/255) alpha:1];
        [KQlable changeLineSpaceForLabel:_literalsPKTwo WithSpace:5.0f];
    }
    return _literalsPKTwo;
}
//正方
- (UIButton *)butOne
{
    if (!_butOne)
    {
        _butOne=[[UIButton alloc] init];
        [_butOne setImage:[UIImage imageNamed:@"zhichizheng"] forState:UIControlStateNormal];
    }
    return _butOne;
}
//反方
- (UIButton *)butTwo
{
    if (!_butTwo)
    {
        _butTwo=[[UIButton alloc] init];
        [_butTwo setImage:[UIImage imageNamed:@"zhichifan"] forState:UIControlStateNormal];
    }
    return _butTwo;
}
//进度条、
- (XDProgressView *)customProgressView
{
    if (!_customProgressView)
    {
        _customProgressView = [[XDProgressView alloc] init];
        //_customProgressView.center = self.view.center;
        _customProgressView.progress = 0.6;
        //_customProgressView.progressTintColor = [UIColor colorWithRed:(178.0/255) green:(64.0/255) blue:(252.0/255) alpha:1];
        //_customProgressView.trackTintColor = [UIColor colorWithRed:(63.0/255) green:(130.0/255) blue:(252.0/255) alpha:1];
        _customProgressView.trackImage = [UIImage imageNamed:@"fanfang"];
        _customProgressView.progressImage = [UIImage imageNamed:@"zhengfang"];
        _customProgressView.text = @"60%            40%";
        _customProgressView.textAlignment = NSTextAlignmentCenter;
        _customProgressView.layer.masksToBounds=YES;
        _customProgressView.layer.cornerRadius=kWidthScale(10);
        
    }
    return _customProgressView;
}
//正
- (UILabel *)zhengLabel
{
    if (!_zhengLabel)
    {
        _zhengLabel=[[UILabel alloc] init];
        _zhengLabel.text=@"700人";
        _zhengLabel.font=[UIFont systemFontOfSize:kWidthScale(12)];
        _zhengLabel.textColor=[UIColor colorWithRed:(178.0/255) green:(64.0/255) blue:(252.0/255) alpha:1];
    }
    return _zhengLabel;
}
- (UILabel *)fanLabel
{
    if (!_fanLabel)
    {
        _fanLabel=[[UILabel alloc] init];
        _fanLabel.text=@"300人";
        _fanLabel.font=[UIFont systemFontOfSize:kWidthScale(12)];
        _fanLabel.textColor=[UIColor colorWithRed:(63.0/255) green:(130.0/255) blue:(252.0/255) alpha:1];
    }
    return _fanLabel;
}
//押注按钮
- (UIButton *) zhengBut
{
    if (!_zhengBut)
    {
        _zhengBut=[UIButton buttonWithType:UIButtonTypeCustom];
        _zhengBut.userInteractionEnabled=YES;
        _zhengBut.backgroundColor = [UIColor clearColor];
        //_zhengBut.alpha=0;
        _zhengBut.tag = 1000010;
    }
    return _zhengBut;
}
- (UIButton *) fanBut
{
    if (!_fanBut)
    {
        _fanBut=[UIButton buttonWithType:UIButtonTypeCustom];
        _fanBut.userInteractionEnabled=YES;
        _fanBut.backgroundColor = [UIColor clearColor];
        //_fanBut.alpha=0;
        _fanBut.tag = 1000011;

    }
    return _fanBut;
}


@end
